package com.lfs.util;

import com.lfs.common.utils.RandomUtils;

import java.net.UnknownHostException;

public class GetOrderUtil {

	/**
	 * 根据服务器IP设置机器号+获取时间戳+5为随机数
	 * 
	 * @throws UnknownHostException
	 */
	public static String getOrderNo(String serverIp) throws UnknownHostException {
		String machineId = serverIp;
		String date = String.valueOf(System.currentTimeMillis());
		return machineId + date + getVerificationCode(5);

	}

	public static String getVerificationCode(int length) {
		StringBuffer vcode = new StringBuffer();
		vcode.append(RandomUtils.randomNumber(length));
		return vcode.toString();
	}
	
	

}
